#include<bits/stdc++.h>
using namespace std;

const int N = 1e5 + 10;
int n;
int a[N];
set<int>s;
int b[N];

signed main() {
	freopen("duel.in", "r", stdin);
	freopen("duel.out", "w", stdout);

	scanf("%d", &n);
	for(int i = 1; i <= n; ++ i) {
		scanf("%d", a + i);
		s.insert(a[i]);
		++ b[a[i]];
	}
	sort(a + 1, a + n + 1);
	
	int inf = 0x3f3f3f3f;
	s.insert(inf);

	int ans = 0;
	for(int i = 1; i <= n; ++ i) {
		int u = *upper_bound(s.begin(), s.end(), a[i]);
		if(u == inf)
			break;
		++ ans;
		if((-- b[u]) == 0)
			s.erase(u);
	}
	printf("%d\n", n - ans);

	fclose(stdin);
	fclose(stdout);
	return 0;
}
